import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/rbac/usernameLogin',
    method: 'post',
    data
  })
}

export function register(data) {
  return request({
    url: '/register',
    method: 'post',
    data
  })
}

export function logout(data) {
  return request({
    url: '/logout',
    method: 'post',
    data
  })
}

export function putPassword(data) {
  return request({
    url: '/rbac/password',
    method: 'put',
    data
  })
}

export function getAdminList(data) {
  return request({
    url: '/admin/list',
    method: 'get',
    data
  })
}

export function info() {
  return request({
    url: '/rbac/info',
    method: 'get'
  })
}

export function getGroups() {
  return request({
    url: '/rbac/groups',
    method: 'get'
  })
}

export function postGroup(data) {
  return request({
    url: '/rbac/group',
    method: 'post',
    data
  })
}

export function deleteGroup(data) {
  return request({
    url: '/rbac/group',
    method: 'delete',
    data
  })
}

export function putGroup(data) {
  return request({
    url: '/rbac/group',
    method: 'put',
    data
  })
}

export function getRoles() {
  return request({
    url: '/rbac/role/list',
    method: 'get'
  })
}

export function postRoles(data) {
  return request({
    url: '/rbac/role',
    method: 'post',
    data
  })
}

export function deleteRoles(data) {
  return request({
    url: '/rbac/role',
    method: 'delete',
    data
  })
}

export function putRoles(data) {
  return request({
    url: '/rbac/role',
    method: 'put',
    data
  })
}
